package com.ruoyi.wms.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.wms.domain.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

/**
 * @author libancang
 * @date 2025-09-12
 */
@Data
@ToString
@ApiModel(value = "报废车辆信息对象", description = "报废车辆信息对象")
public class EndLifeVehicleVo extends EndLifeVehicleBase {

    @ApiModelProperty(value = "报废汽车主键id")
    private String vehicleId;


    @ApiModelProperty(value = "订单主键id")
    private String orderId;

    private WmsOrder order;

    @ApiModelProperty(value = "供应商主键id")
    private String lvBusinessLicenseId;

    private BusinessLicenseInfo businessLicenseInfo;

    private VehicleCancellation vehicleCancellation;

    private EndLifeVehicleExtend endLifeVehicleExtend;

    @ApiModelProperty(value = "二维码")
    private String qrCode;

    public String getQrCode() {
        // 如果 super.getPlateNo() 为空，返回空字符串
        if (StringUtils.isEmpty( getPlateNo())) {
            return "";
        }
        // 如果 qrCode 已经包含正确的链接，直接返回
        String expectedUrl = "https://data.lvlianhengsheng.com/dev-api/file/createCommonQRCode?url=" + getPlateNo();
        if (qrCode != null && qrCode.equals(expectedUrl)) {
            return qrCode;
        }

        // 生成新的二维码链接
        return expectedUrl;
    }
}
